import service from '@/utils/request'

export function getExamListService(params) {
  return service({
    url: "/contest/list",
    method: "get",
    params,
  });
}

export function examAddService(params = {}) {
  return service({
    url: "/contest/add",
    method: "post",
    data: params,
  });
}

export function addExamQuestionService(params = {}) {
  return service({
    url: "/contest/question/add",
    method: "post",
    data: params,
  });
}

export function getExamDetailService(id) {
  return service({
    url: "/contest/detail",
    method: "get",
    params: { id },
  });
}

export function editExamService(params = {}) {
  return service({
    url: "/contest/edit",
    method: "put",
    data: params,
  });
}

export function delExamQuestionService(contestId, questionId) {
  return service({
    url: "/contest/question/delete",
    method: "delete",
    params: { contestId, questionId },
  });
}

export function delExamService(id) {
  return service({
    url: "/contest/delete",
    method: "delete",
    params: { id },
  });
}

export function publishExamService(id) {
  return service({
    url: "/contest/publish",
    method: "put",
    params: { id },
  });
}

export function cancelPublishExamService(id) {
  return service({
    url: "/contest/cancelPublish",
    method: "put",
    params: { id },
  });
}